import { Component, OnInit,Input, ChangeDetectionStrategy, EventEmitter, Output } from '@angular/core';
import { SafeStyle,DomSanitizer } from '@angular/platform-browser';

@Component({
  selector: 'el-tag',
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: './tag.component.html'
})
export class TagComponent implements OnInit {
  private sanitizer:any;
  @Input() type: string = '';
  @Input() closable: boolean = false;
  @Input() hit: boolean = false;
  @Input() color: string = '';
  @Input() size: string = '';
  @Input() closeTransition: boolean = false;
  @Output('close') closeEmitter: EventEmitter<any> = new EventEmitter();
  @Input() tagStyles!: SafeStyle;
  
  constructor(sanitizer: DomSanitizer){
    this.sanitizer = sanitizer;
  };

  ngOnInit(): void {
    var /** @type {?} */ styles = "backgroundColor: " + this.color;
    this.tagStyles = this.sanitizer.bypassSecurityTrustStyle(styles);
  }

}
